<template>
  <div style="padding: 0 10px" @click="toggleClick">
    <svg
      class="refresh"
      viewBox="0 0 1024 1024"
      xmlns="http://www.w3.org/2000/svg"
      width="64"
      height="64"
      fill="currentColor"
    >
      <path
        fill="currentColor"
        d="M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"
      />
    </svg>
  </div>
</template>

<script setup>
  import router from '@/router';
  const toggleClick = () => {
    refreshPage();
  };

  // 刷新当前tab页签
  const refreshPage = () => {
    const { path, query } = router.currentRoute.value;
    router.replace({
      path: '/redirect' + path,
      query: query
    });
  };
</script>

<style scoped>
  .refresh {
    display: inline-block;
    vertical-align: middle;
    width: 20px;
    height: 20px;
  }
</style>
